<?php 
require "DataLoad.php"; 
?>
<!DOCTYPE html PUBLIC "-//W3C//Dth XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/Dth/xhtml1-transitional.dth">

<html>
<head>
<title><?php echo $GuildName;?> - DKP系统</title>
<script language="JavaScript" src="inc/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Generator" content="EditPlus">
<meta name="Author" content="SULei">
<meta name="Keywords" content="DKP WOW GUILD">
<meta name="Description" content="">
<link href="<?php echo $StylePath;?>/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="<?php echo $StylePath;?>/styleplus.js"></script>
<style type="text/css" media="all">

</style>
</head>

<body>
<div class="header">
<?php require "menu.php"; ?>
</div>
<div class="main">

<!-- <textarea class="hi" style="width:550px;height:300px;"></textarea> -->

<?php 
$char = new Player();
$char->setPlayer($_GET['id']);

echo $char->viewBaseInfo();
echo $char->viewLooted();
echo $char->viewEvents();
echo $char->viewFreezEvents();
/**/
?>

</div>
<?php require "footer.php"; ?>


			<script language="JavaScript">
				var charXml = $();
				var itemXml = $();
				var armoryFacepicURL = "<?php echo $armoryFacepicURL;?><%";
				var strcharName = "<?php echo rawurlencode($player_name);?><%";
				var strServerName = "<?php echo rawurlencode($GuildServer);?><%";
				$.get("GetArmory.php", { server: strServerName ,mode:"1" ,sname: strcharName },
				  function(data) {
					//$("textarea.hi").text(data);
					charXml = $("<xml>" + data + "</xml>");
					var facecode = $("character",charXml).attr("genderId") + "-" + $("character",charXml).attr("raceId") + "-" + $("character",charXml).attr("classId") {$classId} 头像命名格式
					if ($("character",charXml).attr("class")) {
					$(".ArmoryCharFrame .face img").attr("src","http://cn.wowarmory.com/images/portraits/wow-70/" + facecode + ".gif");

					$(".ArmoryCharFrame span[name=GuildName]").text($("character",charXml).attr("guildName"));

					$(".ArmoryCharFrame span.level").text($("character",charXml).attr("level"));
					$(".ArmoryCharFrame span.xclass").text($("character",charXml).attr("class"));
					$(".ArmoryCharFrame span.talent").text($("talentSpec",charXml).attr("treeOne") + "/" + $("talentSpec",charXml).attr("treeTwo") + "/" + $("talentSpec",charXml).attr("treeThree"));

					$(".ArmoryCharFrame span.skill1").text($("professions skill:eq(0)",charXml).attr("name"));
					$(".ArmoryCharFrame span.skill2").text($("professions skill:eq(1)",charXml).attr("name"));

					$(".ArmoryCharFrame span.hp").text($("health",charXml).attr("effective"));
					$(".ArmoryCharFrame span.mp").text($("secondBar",charXml).attr("effective"));
					} else { $(".ArmoryCharFrame span[name=GuildName]").text("未能获取Armory数据"); }
					
					for ( i = 0; i < 17 ; i ++ ) {
						if ($("item[slot="+ i +"]",charXml).attr("icon")) {
							$(".ArmoryCharFrame img[name=eq"+ (i+1) +"]").attr("src", armoryFacepicURL + $("item[slot="+ i +"]",charXml).attr("icon") + ".png" );
						}
					};
					//alert($("item[slot=0]",charXml).attr("icon"))
				  }); 
				


			</script>



</body>
</html>
<?php 

function Looted() {
	$sql="select * from raid_event where event_class='拾取' and event_object='".${"id"}."'";
	$result = mysql_query($sql);
	print "<table class='lootlist outframe'><tr><th><div class='title'><img src='images/icon/box.jpg' >战利品</div></th></tr><tr class='coltitle'><td>这里显示的物品只包括了活动中拾取事件所得物品，从特殊事件购买或个人事件分配到的没有列出。</td></tr><tr><td>";//rs("event_object2")
	if ($result->bof || $result->eof) {
		print "未获得过装备";
	}else{
		for ($i=1; $i<=$result->recordcount; $i=$i+1) {
			print "<div class='item'><div class='dkp'>".$result["event_dkp"]."</div>".eqpic($result["event_object2"],$result["event_object2_tooltip"])."<div class='itemname'>".delItemID($result["event_object2"])."</div><div class='link'><a href='raid_report.php?id=".$result["event_raidid"]."'>查看活动</a> <a href='looted_detail.php?keyword=".$result["event_object2"]."'>查看物品</a></div><div class='time'>".$result["event_time"]."</div></div>";
			$tlooted=$tlooted."|".$result["event_object2"];
		}
	} 

	print "</td></tr></table>";

	//更新Player表的Looted字段
	mysql_query("update player set player_looted='".$tlooted."' where id=".$_GET['id']);
	return $function_ret;
} 



/*
function PlayerDetail() {
	$sql="select * from raid_class order by id";
	$result = mysql_query($sql);
	while ($row = mysql_fetch_array($result)) {
		$arrRC[$i]=$row["class_name"];
		$arrRCid[$i]=$row["id"];
	}
//活动记录
	for ($zi=0; $zi<=count($arrRC); $zi=$zi+1) {
		$rol1=$rol1."<th>".raidclassText($arrRCid[$zi])."</th>";
		$rol2=$rol2."<td><b>".totaldkp(${"id"},$arrRCid[$zi])."</b></td>";
		$rol3=$rol3."<td><a class='abtn' href='dkplist_".$arrRCid[$zi].".html'>积分表</a></td>";
		$ttext=null;
	}
	print "<table class='dkpview outframe interlace'>";
	print "<tr>".$rol1."</tr>"."<tr>".$rol2."</tr>"."<tr>".$rol3."</tr>";
	print "</table>";
//活动日志
	$sql="select * from raid where (raid_player like \"% ".${"id"}.",%\" or  raid_player like \"".${"id"}.",%\" or raid_player like \"% ".${"id"}."\")order by raid_actiontime desc";
	$result = mysql_query($sql);
	if ($result->eof || $result->bof) {
		$ttext=$ttext."<tr><td>未参加</td></tr>";
	}
		else
	{
		print "<div class='outframe' style='overflow:auto;height:300px;'><table >";
		for ($i=1; $i<=$result->recordcount; $i=$i+1) {
			$sql="select * from raid_event where event_raidid=".$result["id"]." and event_class='职务任命' and event_object='".${"id"}."'";
			$result2->open;
			if ($result2->eof || $result2->bof) {
				print "<tr class='".linec($i)."'><td>".time_type($result["raid_actiontime"],11)." 参加<a href='raid_report.php?id=".$result["id"]."'>".$result["raid_name"]."</a>活动.</td></tr>";
			}
				else
			{
				print "<tr class='".linec($i)."'><td>".time_type($result["raid_actiontime"],11)." 参加<a href='raid_report.php?id=".$result["id"]."'>".$result["raid_name"]."</a>活动,并任".$result2["event_object2"].".</td></tr>";
			} 
			$result2->close;
			$result->movenext;
		}
		print "</table></div>";
	} 
	return $function_ret;
} 
*/





function showdkp($pid,$rid) {
	extract($GLOBALS);

	$sql="select * from dkplist where playerid=".$pid." and raidid=".$rid;
	$result2->open;
	if ($result2->eof || $result2->bof) {

		$function_ret="活动已归档";
	}
		else
	{

		$function_ret=cPre($result2["dkp"]);
		$tdkp=$tdkp+$result2["dkp"];
	} 

	$result2->close;
	return $function_ret;
} 

function totaldkp($pid,$c) {
	extract($GLOBALS);

	$sql="select * from player_dkp where player_id=".$pid." and raid_class=".$c;
	$result2->open;
	if ($result2->bof || $result2->eof) {

		$function_ret="从未结算过";
	}
		else
	{

		$function_ret=cPre($result2["player_dkp"]);
	} 

	$result2->close;
	return $function_ret;
} 



?>
